import { eventHandler } from 'h3';

export default eventHandler(async (event) => {
  const { status, title, content, category } = await readBody(event);
  // 新增数据
  MOCK_CORPUS_LIST_DATA.push({
    id: MOCK_CORPUS_LIST_DATA.length + 1,
    createdAt: Date.now(),
    updatedAt: Date.now(),
    status,
    title,
    content,
    category,
  });
  return useResponseSuccess({
    message: '新增语料成功',
    data: {
      status,
      title,
      content,
      category,
    },
  });
});
